package com.udesc.larva.delta.ui;

import com.udesc.larva.delta.ui.vo.BalanceOptionEnum;
import com.udesc.larva.delta.ui.vo.LinkingOptionEnum;
import com.udesc.larva.delta.ui.vo.OffsetOptionEnum;
import com.udesc.larva.delta.ui.vo.OrientationOptionEnum;
import com.udesc.larva.delta.ui.vo.TileInterfaceParameter;
import com.udesc.larva.delta.ui.vo.TwistFirstPointOptionEnum;
import com.udesc.larva.delta.ui.vo.TwistReorderOptionEnum;


/**
 * @author  leobittencourt
 */
public class InterfaceTiling extends javax.swing.JFrame {

    // Variables declaration - do not modify
    private javax.swing.JTabbedPane abasTiling;
    private javax.swing.JPanel balancePanel;
    private javax.swing.JButton buttonCancel;
    private javax.swing.JButton buttonOK;
    private javax.swing.JPanel firstPointPanel;
    private javax.swing.ButtonGroup groupBalance;
    private javax.swing.ButtonGroup groupFirstPoint;
    private javax.swing.ButtonGroup groupLinking;
    private javax.swing.ButtonGroup groupOffset;
    private javax.swing.ButtonGroup groupOrientation;
    private javax.swing.ButtonGroup groupReorder;
    private javax.swing.JPanel linkingPanel;
    private javax.swing.JPanel optionPanelBalance;
    private javax.swing.JPanel optionPanelFirstPoint;
    private javax.swing.JPanel optionPanelLinking;
    private javax.swing.JPanel optionPanelOffset;
    private javax.swing.JPanel optionPanelOrientation;
    private javax.swing.JPanel optionPanelReordering;
    private javax.swing.JPanel orientationPanel;
    private javax.swing.JPanel principalPanel;
    private javax.swing.JRadioButton rbAdaptadaLiMaTan;
    private javax.swing.JRadioButton rbAnzolin;
    private javax.swing.JRadioButton rbBoudingBox;
    private javax.swing.JRadioButton rbBoundingCircle;
    private javax.swing.JRadioButton rbDistancia2D;
    private javax.swing.JRadioButton rbDistanciaCega;
    private javax.swing.JRadioButton rbExtendidaLiMaTan;
    private javax.swing.JRadioButton rbExtensaoAnzolin;
    private javax.swing.JRadioButton rbFP2D;
    private javax.swing.JRadioButton rbFP3D;
    private javax.swing.JRadioButton rbFPAnzolin;
    private javax.swing.JRadioButton rbIndice;
    private javax.swing.JRadioButton rbLiMaTan;
    private javax.swing.JRadioButton rbMediaPontos;
    private javax.swing.JRadioButton rbQuadrangular;
    private javax.swing.JRadioButton rbReorderBruteForce;
    private javax.swing.JRadioButton rbReorderIndex;
    private javax.swing.JRadioButton rbReorderIndirect;
    private javax.swing.JRadioButton rbSemBalance;
    private javax.swing.JRadioButton rbSemOrientacao;
    private javax.swing.JRadioButton rbComOrientacao;
    private javax.swing.JRadioButton rbTriangular;
    private javax.swing.JRadioButton rbdistancia3D;
    
    private InterfaceAction action;
    // End of variables declaration

	
	
    public InterfaceTiling(InterfaceAction action) {
    	this.action = action;
        initComponents();
    }
    
    private void initComponents() {

        groupLinking = new javax.swing.ButtonGroup();
        groupBalance = new javax.swing.ButtonGroup();
        groupFirstPoint = new javax.swing.ButtonGroup();
        groupReorder = new javax.swing.ButtonGroup();
        groupOrientation = new javax.swing.ButtonGroup();
        groupOffset = new javax.swing.ButtonGroup();
        abasTiling = new javax.swing.JTabbedPane();
        balancePanel = new javax.swing.JPanel();
        optionPanelBalance = new javax.swing.JPanel();
        rbAnzolin = new javax.swing.JRadioButton();
        rbExtensaoAnzolin = new javax.swing.JRadioButton();
        rbLiMaTan = new javax.swing.JRadioButton();
        rbAdaptadaLiMaTan = new javax.swing.JRadioButton();
        rbExtendidaLiMaTan = new javax.swing.JRadioButton();
        rbDistanciaCega = new javax.swing.JRadioButton();
        rbSemBalance = new javax.swing.JRadioButton();
        linkingPanel = new javax.swing.JPanel();
        optionPanelLinking = new javax.swing.JPanel();
        rbTriangular = new javax.swing.JRadioButton();
        rbQuadrangular = new javax.swing.JRadioButton();
        rbIndice = new javax.swing.JRadioButton();
        rbDistancia2D = new javax.swing.JRadioButton();
        rbdistancia3D = new javax.swing.JRadioButton();
        firstPointPanel = new javax.swing.JPanel();
        optionPanelFirstPoint = new javax.swing.JPanel();
        rbFP3D = new javax.swing.JRadioButton();
        rbFP2D = new javax.swing.JRadioButton();
        rbFPAnzolin = new javax.swing.JRadioButton();
        optionPanelReordering = new javax.swing.JPanel();
        rbReorderIndirect = new javax.swing.JRadioButton();
        rbReorderIndex = new javax.swing.JRadioButton();
        rbReorderBruteForce = new javax.swing.JRadioButton();
        orientationPanel = new javax.swing.JPanel();
        optionPanelOrientation = new javax.swing.JPanel();
        rbComOrientacao = new javax.swing.JRadioButton();
        rbSemOrientacao = new javax.swing.JRadioButton();
        principalPanel = new javax.swing.JPanel();
        optionPanelOffset = new javax.swing.JPanel();
        rbBoudingBox = new javax.swing.JRadioButton();
        rbBoundingCircle = new javax.swing.JRadioButton();
        rbMediaPontos = new javax.swing.JRadioButton();
        buttonOK = new javax.swing.JButton();
        buttonCancel = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Tiling Options");
        setAlwaysOnTop(true);
        setResizable(false);

        optionPanelBalance.setBorder(javax.swing.BorderFactory.createTitledBorder("Choose a balancing option:"));

        groupBalance.add(rbAnzolin);
        rbAnzolin.setSelected(true);
        rbAnzolin.setText("Distance Distribuition");

        groupBalance.add(rbExtensaoAnzolin);
        rbExtensaoAnzolin.setText("Lean Distribuition");

        groupBalance.add(rbLiMaTan);
        rbLiMaTan.setText("Local Proportional Distribuition");

        groupBalance.add(rbAdaptadaLiMaTan);
        rbAdaptadaLiMaTan.setText("Proximal Distribuition");
        rbAdaptadaLiMaTan.setEnabled(false);

        groupBalance.add(rbExtendidaLiMaTan);
        rbExtendidaLiMaTan.setText("Exatly Distribuition");

        groupBalance.add(rbDistanciaCega);
        rbDistanciaCega.setText("Blind Distribuition");

        groupBalance.add(rbSemBalance);
        rbSemBalance.setText("No Balancing");

        javax.swing.GroupLayout optionPanelBalanceLayout = new javax.swing.GroupLayout(optionPanelBalance);
        optionPanelBalance.setLayout(optionPanelBalanceLayout);
        optionPanelBalanceLayout.setHorizontalGroup(
            optionPanelBalanceLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelBalanceLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(optionPanelBalanceLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbAnzolin)
                    .addComponent(rbExtensaoAnzolin)
                    .addComponent(rbLiMaTan)
                    .addComponent(rbAdaptadaLiMaTan)
                    .addComponent(rbExtendidaLiMaTan)
                    .addComponent(rbDistanciaCega)
                    .addComponent(rbSemBalance))
                .addContainerGap(65, Short.MAX_VALUE))
        );
        optionPanelBalanceLayout.setVerticalGroup(
            optionPanelBalanceLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelBalanceLayout.createSequentialGroup()
                .addComponent(rbAnzolin)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbExtensaoAnzolin)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbLiMaTan)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbAdaptadaLiMaTan)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbExtendidaLiMaTan)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbDistanciaCega)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbSemBalance)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout balancePanelLayout = new javax.swing.GroupLayout(balancePanel);
        balancePanel.setLayout(balancePanelLayout);
        balancePanelLayout.setHorizontalGroup(
            balancePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(balancePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(optionPanelBalance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        balancePanelLayout.setVerticalGroup(
            balancePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, balancePanelLayout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addComponent(optionPanelBalance, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );


        optionPanelLinking.setBorder(javax.swing.BorderFactory.createTitledBorder("Choose a Linking option: "));

        groupLinking.add(rbTriangular);
        rbTriangular.setSelected(true);
        rbTriangular.setText("Triangular");

        groupLinking.add(rbQuadrangular);
        rbQuadrangular.setText("Quadrangular");

        groupLinking.add(rbIndice);
        rbIndice.setText("Multiple");

        groupLinking.add(rbDistancia2D);
        rbDistancia2D.setText("Two-dimensional Distance");

        groupLinking.add(rbdistancia3D);
        rbdistancia3D.setText("Three-dimensional Distance");

        javax.swing.GroupLayout optionPanelLinkingLayout = new javax.swing.GroupLayout(optionPanelLinking);
        optionPanelLinking.setLayout(optionPanelLinkingLayout);
        optionPanelLinkingLayout.setHorizontalGroup(
            optionPanelLinkingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelLinkingLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(optionPanelLinkingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbTriangular)
                    .addComponent(rbQuadrangular)
                    .addComponent(rbIndice)
                    .addComponent(rbDistancia2D)
                    .addComponent(rbdistancia3D))
                .addContainerGap(65, Short.MAX_VALUE))
        );
        optionPanelLinkingLayout.setVerticalGroup(
            optionPanelLinkingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelLinkingLayout.createSequentialGroup()
                .addComponent(rbTriangular)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbQuadrangular)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbIndice)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbDistancia2D)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbdistancia3D)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout linkingPanelLayout = new javax.swing.GroupLayout(linkingPanel);
        linkingPanel.setLayout(linkingPanelLayout);
        linkingPanelLayout.setHorizontalGroup(
            linkingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(linkingPanelLayout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(optionPanelLinking, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(91, Short.MAX_VALUE))
        );
        linkingPanelLayout.setVerticalGroup(
            linkingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(linkingPanelLayout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(optionPanelLinking, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(60, Short.MAX_VALUE))
        );

    
        optionPanelFirstPoint.setBorder(javax.swing.BorderFactory.createTitledBorder("Choose a First Point option"));

        groupFirstPoint.add(rbFP3D);
        rbFP3D.setText("Closed 3D");

        groupFirstPoint.add(rbFP2D);
        rbFP2D.setText("Closed 2D");

        groupFirstPoint.add(rbFPAnzolin);
        rbFPAnzolin.setSelected(true);
        rbFPAnzolin.setText("Closed to auxiliar point");

        javax.swing.GroupLayout optionPanelFirstPointLayout = new javax.swing.GroupLayout(optionPanelFirstPoint);
        optionPanelFirstPoint.setLayout(optionPanelFirstPointLayout);
        optionPanelFirstPointLayout.setHorizontalGroup(
            optionPanelFirstPointLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelFirstPointLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(optionPanelFirstPointLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbFP2D)
                    .addComponent(rbFP3D)
                    .addComponent(rbFPAnzolin)))
        );
        optionPanelFirstPointLayout.setVerticalGroup(
            optionPanelFirstPointLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelFirstPointLayout.createSequentialGroup()
                .addComponent(rbFPAnzolin)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbFP2D)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(rbFP3D))
        );

        optionPanelReordering.setBorder(javax.swing.BorderFactory.createTitledBorder("Choose a Reordering option"));

        groupReorder.add(rbReorderIndirect);
        rbReorderIndirect.setText("Indirect");
        rbReorderIndirect.setEnabled(false);

        groupReorder.add(rbReorderIndex);
        rbReorderIndex.setSelected(true);
        rbReorderIndex.setText("Index");

        groupReorder.add(rbReorderBruteForce);
        rbReorderBruteForce.setText("Brutal Force");
        rbReorderBruteForce.setSelected(false);

        javax.swing.GroupLayout optionPanelReorderingLayout = new javax.swing.GroupLayout(optionPanelReordering);
        optionPanelReordering.setLayout(optionPanelReorderingLayout);
        optionPanelReorderingLayout.setHorizontalGroup(
            optionPanelReorderingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelReorderingLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(optionPanelReorderingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbReorderIndirect)
                    .addComponent(rbReorderIndex)
                    .addComponent(rbReorderBruteForce))
                .addContainerGap(146, Short.MAX_VALUE))
        );
        optionPanelReorderingLayout.setVerticalGroup(
            optionPanelReorderingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, optionPanelReorderingLayout.createSequentialGroup()
                .addComponent(rbReorderIndex)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(rbReorderBruteForce)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbReorderIndirect))
        );

        javax.swing.GroupLayout firstPointPanelLayout = new javax.swing.GroupLayout(firstPointPanel);
        firstPointPanel.setLayout(firstPointPanelLayout);
        firstPointPanelLayout.setHorizontalGroup(
            firstPointPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(firstPointPanelLayout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(firstPointPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(optionPanelReordering, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(optionPanelFirstPoint, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(78, Short.MAX_VALUE))
        );
        firstPointPanelLayout.setVerticalGroup(
            firstPointPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(firstPointPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(optionPanelFirstPoint, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(optionPanelReordering, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(24, Short.MAX_VALUE))
        );

    

        optionPanelOrientation.setBorder(javax.swing.BorderFactory.createTitledBorder("The contours are oriented:"));

        groupOrientation.add(rbComOrientacao);
        rbComOrientacao.setSelected(false);
        rbComOrientacao.setEnabled(false);
        rbComOrientacao.setText("Yes (Counterclockwise or Anti-Counterclockwise)");

        groupOrientation.add(rbSemOrientacao);
        rbSemOrientacao.setText("No");
        rbSemOrientacao.setSelected(true);

        javax.swing.GroupLayout optionPanelOrientationLayout = new javax.swing.GroupLayout(optionPanelOrientation);
        optionPanelOrientation.setLayout(optionPanelOrientationLayout);
        optionPanelOrientationLayout.setHorizontalGroup(
            optionPanelOrientationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelOrientationLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(optionPanelOrientationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbComOrientacao)
                    .addComponent(rbSemOrientacao))
                .addContainerGap(73, Short.MAX_VALUE))
        );
        optionPanelOrientationLayout.setVerticalGroup(
            optionPanelOrientationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelOrientationLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rbComOrientacao)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbSemOrientacao)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout orientationPanelLayout = new javax.swing.GroupLayout(orientationPanel);
        orientationPanel.setLayout(orientationPanelLayout);
        orientationPanelLayout.setHorizontalGroup(
            orientationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(orientationPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(optionPanelOrientation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(121, Short.MAX_VALUE))
        );
        orientationPanelLayout.setVerticalGroup(
            orientationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(orientationPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(optionPanelOrientation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(143, Short.MAX_VALUE))
        );

 

        optionPanelOffset.setBorder(javax.swing.BorderFactory.createTitledBorder("Choose a Offsetting option"));

        groupOffset.add(rbBoudingBox);
        rbBoudingBox.setSelected(false);
        rbBoudingBox.setText("Arithmetic average of extreme points x and y");

        groupOffset.add(rbBoundingCircle);
        rbBoundingCircle.setText("Bounding Circle");

        groupOffset.add(rbMediaPontos);
        rbMediaPontos.setText("Arithmetic of all points");

        javax.swing.GroupLayout optionPanelOffsetLayout = new javax.swing.GroupLayout(optionPanelOffset);
        optionPanelOffset.setLayout(optionPanelOffsetLayout);
        optionPanelOffsetLayout.setHorizontalGroup(
            optionPanelOffsetLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelOffsetLayout.createSequentialGroup()
                .addGroup(optionPanelOffsetLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbBoudingBox)
                    .addComponent(rbBoundingCircle)
                    .addComponent(rbMediaPontos))
                .addContainerGap(28, Short.MAX_VALUE))
        );
        optionPanelOffsetLayout.setVerticalGroup(
            optionPanelOffsetLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelOffsetLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rbBoudingBox)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbBoundingCircle)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbMediaPontos)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout principalPanelLayout = new javax.swing.GroupLayout(principalPanel);
        principalPanel.setLayout(principalPanelLayout);
        principalPanelLayout.setHorizontalGroup(
            principalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(principalPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(optionPanelOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(25, Short.MAX_VALUE))
        );
        principalPanelLayout.setVerticalGroup(
            principalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(principalPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(optionPanelOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(115, Short.MAX_VALUE))
        );


        buttonOK.setText("OK");
        buttonOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonOKActionPerformed(evt);
            }
        });

        buttonCancel.setText("Cancel");
        buttonCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCancelActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(abasTiling, javax.swing.GroupLayout.PREFERRED_SIZE, 390, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGroup(layout.createSequentialGroup()
                .addGap(70, 70, 70)
                .addComponent(buttonOK, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(120, 120, 120)
                .addComponent(buttonCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(abasTiling, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(buttonOK)
                    .addComponent(buttonCancel)))
        );

        abasTiling.addTab("Curve Twisting", firstPointPanel);
        abasTiling.addTab("Curve Orientation", orientationPanel);
        abasTiling.addTab("Curve Offsetting", principalPanel);
        abasTiling.addTab("Point Balancing", balancePanel);
        abasTiling.addTab("Point Linking", linkingPanel);
        
        abasTiling.getAccessibleContext().setAccessibleName("");

        pack();
    }

	private void buttonOKActionPerformed(java.awt.event.ActionEvent e) {
		TileInterfaceParameter parameterInterfaceTile = new TileInterfaceParameter();
		
		if(this.rbAnzolin.isSelected()){
			parameterInterfaceTile.setBalanceOption(BalanceOptionEnum.ANZOLIN.ordinal());
		}else if(this.rbExtensaoAnzolin.isSelected()){
			parameterInterfaceTile.setBalanceOption(BalanceOptionEnum.EXTENSAO_ANZOLIN.ordinal());
		}else if(this.rbLiMaTan.isSelected()){
			parameterInterfaceTile.setBalanceOption(BalanceOptionEnum.DIST_PROP_LOCAL.ordinal());
		}else if(this.rbAdaptadaLiMaTan.isSelected()){
			parameterInterfaceTile.setBalanceOption(BalanceOptionEnum.DIST_PROP_LOCAL_ADAPTADA.ordinal());
		}else if(this.rbExtendidaLiMaTan.isSelected()){
			parameterInterfaceTile.setBalanceOption(BalanceOptionEnum.DIST_PROP_LOCAL_EXTENTIDA.ordinal());
		}else if(this.rbDistanciaCega.isSelected()){
			parameterInterfaceTile.setBalanceOption(BalanceOptionEnum.DIST_CEGA.ordinal());
		}else if(this.rbSemBalance.isSelected()){
			parameterInterfaceTile.setBalanceOption(BalanceOptionEnum.SEM_BALANCEAMENTO.ordinal());
		}
		
		if(this.rbTriangular.isSelected()){
			parameterInterfaceTile.setLinkingOption(LinkingOptionEnum.TRIANGULAR.ordinal());
		}else if(this.rbQuadrangular.isSelected()){
			parameterInterfaceTile.setLinkingOption(LinkingOptionEnum.QUADRANGULAR.ordinal());
		}else if(this.rbIndice.isSelected()){
			parameterInterfaceTile.setLinkingOption(LinkingOptionEnum.INDICE.ordinal());
		}else if(this.rbDistancia2D.isSelected()){
			parameterInterfaceTile.setLinkingOption(LinkingOptionEnum.DIST_2D.ordinal());
		}else if(this.rbdistancia3D.isSelected()){
			parameterInterfaceTile.setLinkingOption(LinkingOptionEnum.DIST_3D.ordinal());
		}
		
		if(this.rbFPAnzolin.isSelected()){
			parameterInterfaceTile.setFirstPointOption(TwistFirstPointOptionEnum.PONTO_AUXILIAR.ordinal());
		}else if(this.rbFP2D.isSelected()){
			parameterInterfaceTile.setFirstPointOption(TwistFirstPointOptionEnum.PROXIMO_2D.ordinal());
		}else if(this.rbFP3D.isSelected()){
			parameterInterfaceTile.setFirstPointOption(TwistFirstPointOptionEnum.PROXIMO_3D.ordinal());
		}
			
		if(this.rbReorderIndex.isSelected()){
			parameterInterfaceTile.setReorderOption(TwistReorderOptionEnum.INDICE.ordinal());
		}else if(this.rbReorderBruteForce.isSelected()){
			parameterInterfaceTile.setReorderOption(TwistReorderOptionEnum.FORCA_BRUTA.ordinal());
		}else if(this.rbReorderIndirect.isSelected()){
			parameterInterfaceTile.setReorderOption(TwistReorderOptionEnum.INDIRETA.ordinal());
		}
		
		if(this.rbComOrientacao.isSelected()){
			parameterInterfaceTile.setOrientationOption(OrientationOptionEnum.ORIENTADO.ordinal());
		}else if(this.rbSemOrientacao.isSelected()){
			parameterInterfaceTile.setOrientationOption(OrientationOptionEnum.NAO_ORIENTADO.ordinal());
		}
		
		if(this.rbBoudingBox.isSelected()){
			parameterInterfaceTile.setOffsetOption(OffsetOptionEnum.MEDIA_EXTREMOS_X_Y.ordinal());
		}else if(this.rbBoundingCircle.isSelected()){
			parameterInterfaceTile.setOffsetOption(OffsetOptionEnum.BOUNDING_CIRCLE.ordinal());
		}else if(this.rbMediaPontos.isSelected()){
			parameterInterfaceTile.setOffsetOption(OffsetOptionEnum.MEDIA_TODOS_PONTOS.ordinal());
		}

		this.action.setParametroTiling(parameterInterfaceTile);
		this.setVisible(false);
		this.action.interpolaButtonClicked(e);

	}                                        
	
	private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {                                             
	    this.setVisible(false);
	}                                            

}
